/*
struct TreeNode {
	int val;
	struct TreeNode *left;
	struct TreeNode *right;
	TreeNode(int x) :
			val(x), left(NULL), right(NULL) {
	}
};*/
class Solution {
public:
    vector<vector<int>> res;
    vector<int> path;
    vector<vector<int>> FindPath(TreeNode* root,int expectNumber) {
        dfs(root,expectNumber);
        return res;
    }
    void dfs(TreeNode* root,int num)
    {
        if(root==nullptr)
            return;
        num-=root->val;
        path.push_back(root->val);
        //num==0,并且到了叶子结点，说明这条路径符合
        if(!num&&root->left==nullptr&&root->right==nullptr)
            res.push_back(path);
        dfs(root->left,num);
        dfs(root->right,num);
        path.pop_back();//代码走到这里，表明要回溯
    }
};